import Login from "@/pages/Login";
import Layout from "@/pages/Layout";
import AuthRoute from "@/components/AuthRoute";//权限控制

import { lazy, Suspense } from "react";//路由懒加载

// import Home from "@/pages/Home";
// import Aticle from "@/pages/Aticle";
// import Publish from "@/pages/Publish";

const Home = lazy(()=>import('@/pages/Home'))
const Aticle = lazy(()=>import('@/pages/Aticle'))
const Publish = lazy(()=>import('@/pages/Publish'))
const New = lazy(()=>import('@/pages/New'))

const routes = [
   {
     path: "/",
     element: <Suspense fallback={'加载中'}><AuthRoute><Layout></Layout></AuthRoute></Suspense>,
     children: [
       {
         index: true,
        //  path: "home",
         element:<Suspense><Home></Home></Suspense>,
       },
       {
        path: "aticle",
        element:<Suspense><Aticle></Aticle></Suspense>,
      },
      {
        path: "publish",
        element:<Suspense><Publish></Publish></Suspense>
      },
      {
        path: "new",
        element:<Suspense><New></New></Suspense>
      },
     ],
   },
   {
     path: "/login",
     element:<Login></Login>,
   },
]

export default routes;